package e.odbo.data;

import e.odbo.data.model.ColumnFlag;
import e.odbo.data.model.ColumnType;
import e.odbo.data.model.ForeignKeyFlag;
import e.odbo.data.model.I_ColumnGather;
import e.odbo.data.model.smaple.*;

public class E extends OdbO {
    public static final OdbOContent CONTENT=new OdbOContent();

    private static OdbOConfig baseConfig;

    public static OdbOConfig Config(){
        if(baseConfig==null)
            baseConfig=new OdbOConfig();
        return baseConfig;
    }

    public static final class DB{
        public static final class TABLE{
            public static final class COLUMN_IMPLEMENT{

                public static final I_ColumnGather PK_String=PK.PK_String;

                public static final I_ColumnGather PK_Int=PK.PK_Int;

                public static final I_ColumnGather PK_Long=PK.PK_Long;

                public static final I_ColumnGather PK_UUID=PK.PK_UUID;

                public final static TimeLogAble   MODIFY_LOG=TimeLogAble.Instance;

                public final static VersionControlAble VERSION=VersionControlAble.Instance;

                public final static SoftDeleteControlAble SOFT_DELETE=SoftDeleteControlAble.Instance;

                public  static UserLogAble USER_LOG_REF_INT(final String refTable, final String refPK){
                    return UserLogAble.Instance_INT(refTable,refPK);
                }

                public  static UserLogAble USER_LOG_REF_INT(final String refTable, final String refPK, final ForeignKeyFlag refCascade_del, final ForeignKeyFlag refCascade_update){
                    return UserLogAble.Instance_INT(refTable,refPK,refCascade_del,refCascade_update);
                }

                public  static UserLogAble USER_LOG_REF_STRING(final String refTable, final String refPK){
                    return UserLogAble.Instance_STRING(refTable,refPK);
                }

                public  static UserLogAble USER_LOG_REF_STRING(final String refTable, final String refPK, final ForeignKeyFlag refCascade_del, final ForeignKeyFlag refCascade_update){
                    return UserLogAble.Instance_STRING(refTable,refPK,refCascade_del,refCascade_update);
                }
            }

            public static abstract class COLUMN_FLAG extends ColumnFlag {}


            public static abstract class COLUMN_TYPE extends ColumnType<Object>{}

            public static final class FOREIGN_KEY_FLAG{
                public static final ForeignKeyFlag NO_SET=ForeignKeyFlag.NO_SET;

                public static final ForeignKeyFlag RESTRICT=ForeignKeyFlag.RESTRICT;

                public static final ForeignKeyFlag SET_NULL=ForeignKeyFlag.SET_NULL;
            }
        }


        //通用SQL函数定义
        public  static class FUNC{
            public  final static String NOW="NOW";
            public  final static String LEN="LEN";
            public  final static String MID="MID";
            public  final static String LCASE="LCASE";
            public  final static String UCASE="UCASE";
            public  final static String SUM="SUM";
            public  final static String MIN="MIN";
            public  final static String MAX="MAX";
            public  final static String LAST="LAST";
            public  final static String FIRST="FIRST";
            public  final static String AVG="AVG";
            public  final static String COUNT="COUNT";
            public  final static String ROUND="ROUND";
            public  final static String FORMAT="FORMAT";
        }
    }
}
